package com.etc.controller;

import com.etc.entity.CommentResult;
import com.etc.entity.Payment;
import com.etc.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PaymentController {
    @Autowired
    private PaymentService paymentService;

    @RequestMapping("payment/update")
    public CommentResult update(@RequestBody Payment payment)
    {
        System.out.println(payment);
        int result = paymentService.update(payment);
        if (result>0){
            return new CommentResult(200,"success");
        }
        else {
            return new CommentResult(444,"failed");
        }
    }

    @RequestMapping("payment/changeStatus")
    public CommentResult changeStatus(){
        int result = paymentService.changeStauts();
        if (result>0){
            return new CommentResult(200,"success");
        }
        else {
            return new CommentResult(444,"failed");
        }
    }
}
